package keeto.com.vn.bms.network.task;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;
import org.json.JSONException;

import keeto.com.vn.bms.config.IBMSCore;
import keeto.com.vn.bms.network.IBMSProtocol;
import keeto.com.vn.bms.network.request.SendDeleteMessagerRequest;
import keeto.com.vn.bms.network.response.SendDeleteMessagerResponse;
import keeto.com.vn.bms.utils.BMSListener;

public class TaskSendDeleteMessager extends AbstractTask {
	private String listId;
	private String Authkey;


	public TaskSendDeleteMessager(BMSListener listener, IBMSCore core,
			String listId, String authkey) {
		super(listener, core);
		this.listId = listId;
		this.Authkey = authkey;
	}

	@Override
	public void run() throws ClientProtocolException, JSONException,
			IOException {
		// TODO Auto-generated method stub
		SendDeleteMessagerRequest request = new  SendDeleteMessagerRequest();
		request.setListId(listId);
		request.setAuthKey(Authkey);
		SendDeleteMessagerResponse response = protocol.sendDeleteMessager(request);
		for(BMSListener mListener:listener){
			mListener.finishSendDeleteMessager(response.getReturnCode(),response.getResultMsg());
		}
	}
//	BMSListener
	@Override
	public void timeoutCallback() {
		// TODO Auto-generated method stub
		for(BMSListener mListener:listener){
			mListener.finishSendDeleteMessager(IBMSProtocol.STATUS_CODE_GENERIC_FAIL_CONECTTION,null);
		} 
	}

}
